<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script>
        // 将数组 [2, 6, 77, 52, 25, 7] 中大于等于 10 的元素选出来，放入新数组。
        // 核心思路：遍历数组的元素，判断大于等于10，放入新的数组。
        var arr = [2, 6, 77, 52, 25, 7];
        var arr1 = [];
        var arr2 = [];
        var index = 0;
        for (var i = 0; i < arr.length; i++) {
            console.log(arr[i]);
            if (arr[i] >= 10) {
                arr1[index] = arr[i];
                index++;
            }
            
        }
        console.log(arr1);
        console.log('-----------------------');
        for (var i = 0; i < arr.length; i++) {
            if (arr[i] >= 10) {
                arr2[arr2.length] = arr[i];
            }
        }
        console.log(arr2);
    </script>
</head>

<body>

</body>

</html>